<template>
  <div id="app">
    <nav>
      <!-- 跳转路由 -->
      <router-link v-for="(item,idx) in nav" :key="idx" :to="item.href">{{item.title}}</router-link>
    </nav>
    <!-- 路由视图：渲染路由组件 -->
    <router-view/>
  </div>
</template>

<script>
export default {
  name: "app",
  data(){
    return {
      nav:[{
        title:"首页",
        href:"/home"
      },{
        title:"广场",
        href:"/square"
      },{
        title:"问答",
        href:"/qa"
      },{
        title:"体系",
        href:"/system"
      },{
        title:"项目",
        href:"/project"
      }]
    }
  }
}
</script>

<style lang="less">
html,body{
  margin:0;padding:0;
}
#app {
  font-family: Avenir, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  color: #2c3e50;
}

nav {
  width:100%;
  line-height: 40px;
  display: flex;
  a {
    flex:1;
    text-align:center;
    font-weight: bold;
    color: #2c3e50;
    &.router-link-exact-active {
      color: #42b983;
    }
    &:hover{
      background: #f6f6f6;
    }
    &:active{
      background: #efefef;
    }
  }
}
</style>
